<?
  session_start();
  
  
?>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server"> 
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/> 
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/> 
<title>Ubicacion Mapa</title> 

<script type="text/javascript" src="https://maps-api-ssl.google.com/maps/api/js?v=3&sensor=false"></script> 
<script type="text/javascript"> 
  var geocoder;
  var map;
  function initialize() {
      var caller = document.getElementById("hdCaller").value;
      
      
      var msg;
      switch (caller) {
          case "bid":
              msg = "This is an approximate location and may not represent the actual address for the project.";
              break;
          case "company":
              msg = "This is an approximate location and may not represent the actual address for the company location.";
              break;
          default:
              msg = "";
              break;
      }
      document.getElementById("lblInfo").innerHTML = msg;

      geocoder = new google.maps.Geocoder();

      var address = document.getElementById("hdAddress").value;
      geocoder.geocode({ 'address': address }, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
              var myOptions = {
                  zoom: 15,
                  center: results[0].geometry.location,
                  mapTypeId: google.maps.MapTypeId.ROADMAP
              }
              map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

              map.setCenter(results[0].geometry.location);
              var marker = new google.maps.Marker({
                  map: map,
                  position: results[0].geometry.location
              });
          } else {
              document.getElementById("map_canvas").style.display = "none";
              document.getElementById("errormessage").style.display = "block";
              switch (status) {
                  case google.maps.GeocoderStatus.ZERO_RESULTS:
                      parent.Alert("", "Error Message", "Cannot load the map. The address appears be incorrect.");
                      break;
                  case google.maps.GeocoderStatus.OVER_QUERY_LIMIT:
                      parent.Alert("", "Error Message", "Cannot load the map. Google Server Busy. Try again later.");
                      break;
                  case google.maps.GeocoderStatus.REQUEST_DENIED:
                      parent.Alert("", "Error Message", "Cannot load the map. Request denied.");
                      break;
                  case google.maps.GeocoderStatus.INVALID_REQUEST:
                      parent.Alert("", "Error Message", "Cannot load the map. The parameters appears be incorrect.");
                      break;
                  default:
                      parent.Alert("", "Error Message", "Cannot load the map. Error not controlled.");
                      break;
              }

              parent.focus();

          }
      });
  }
</script> 

</head> 
<body class="borderColor" onload="initialize()" style="margin:0px; padding:0px; padding-left:8px;"> 
<input id="hdAddress" type="hidden" value="<? echo $_GET['parametro'] ?>" runat="server" />
<input id="hdCaller" type="hidden" value="" runat="server" />
<label id="lblInfo" runat="server" style="color:White; font-family:Arial; font-size:12px;"></label>  
<div id="map_canvas" style="height:400px; width:404px;" ></div>
<div id="errormessage" style=" width:390px; height:380px;background-color:White; display:none;" align="left" >
    <div style="width:300px;">
        Error loading map...    
    </div>
</div>  
</body> 
</html>